<template>
  <a :href="href | userDetailFilter" v-on:click.stop>
    <img :src="src || defaultAvatar || require('@/assets/img/tou1@2x.png')" :class="$style.avatar">
  </a>
</template>

<script>
  import { userDetailFilter } from '../filters/userFilter'
  import Utils from '../tools/utils'

  export default {
    props: {
      href: String,
      src: String
    },
    filters: {
      userDetailFilter
    },
    computed: {
      defaultAvatar () {
        return Utils.getDefaultUserHead(this.href)
      }
    }
  }
</script>

<style module>
  .avatar {
    width: 58px;
    height: 58px;
    object-fit: cover;
    border-radius: 999px;/*no*/
    border: 1px solid #FEFEFE;/*no*/
  }
</style>
